<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>准时放款流程项目合格证信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<script type="text/javascript">
	var grid = null;
	var isAllowPay = '${isAllowPay}';
	$(function () {
		initGrid();//grid
	});
	//初始化列表
	function initGrid(){
		var isAuditNode='${isAuditNode}';
		var isGpsNode='${isGpsNode}';
		var params = {};
		$("#grid").ligerGrid({
	    	url: '<%=path%>/project/prjprdvehinfo/initPrjPrdVehInfoListInFlow.do?paySchNo=${paySchNo}',
	    	method : 'get',
	        columns: [
	                  { display: '合格证号', name: 'certNo', minWidth: 80 ,align:'left',
	  	            	render: function (rowdata, rowindex, value, column) { 
	  	            		 var no = rowdata.certNo==null?" ":rowdata.certNo;
	  	            		var h = '';
	  	            		if(no&&rowdata.isDel==CommonConstant.C_YN_N_0){
	  	            		    h='<a  href="javascript:detailBtn(';
	  	                        h+="'"+rowdata.id+"',";
	  	                        h+="'"+rowdata.dtlId+"'";
	  	                        h+=')">'+no+'</a>'
	  	            		}
	  	                        return h;
	  	            		},
	  	            	enabledSort:true},
	            { display: '合同号', name: 'lsCntNo', minWidth: 80 ,align:'left',enabledSort:true},
	            { display: '客户名称', name: 'cstNm', minWidth: 60,align:'left',enabledSort:true},
	            { display: '项目类型', name: 'prjTypCdNm', minWidth: 60,align:'left',enabledSort:true}, 
	            { display: '业务类型', name: 'bizTypCdNm', minWidth: 60,align:'left', enabledSort:true}, 
	             { display: '租赁物名称', name: 'prdNm', minWidth: 80,align:'left',enabledSort:true}, 	
	              { display: '支付表号', name: 'paySchNo', minWidth: 100,align:'left',enabledSort:true},
	          /*    { display: '型号', name: 'prdMdl', minWidth: 100,enabledSort:true}, 	 */
	             { display: '车架号', name: 'vin', minWidth: 80,align:'left',enabledSort:true},
	             { display: 'VIN校验结果', name: 'vinValidResNm', minWidth: 80,align:'left',enabledSort:true},
	             { display: 'VIN校验结果', name: 'vinValidRes',hide:true, minWidth: 80,align:'left',enabledSort:true},
	        /*      { display: '审核状态', name: 'audStsCdNm', minWidth: 60,align:'left',enabledSort:true}, 	 */
	             {
	                display: '操作',
	                isSort: false,
	                width: 200,
	                align:'left',
	                render: function (rowdata, rowindex, value){
	                	  var h="";
	                	  if (!isAllowPay || isAllowPay !== '0'){
							  if(rowdata.certNo&&rowdata.isDel==CommonConstant.C_YN_N_0){
								  if(isAuditNode=='1'){
									  h='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
									  h+="'"+rowdata.id+"',";
									  h+="'"+rowdata.dtlId+"',";
									  //h+="'"+isGpsNode+"'";
									  h+=')"><i class="sqBtnIco_4"></i>修改</a>';
								  }
								  if(isGpsNode =='1'){
									  h+='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
									  h+="'"+rowdata.id+"',";
									  h+="'"+rowdata.dtlId+"',";
									  h+="'"+isGpsNode+"'";
									  h+=')"><i class="sqBtnIco_4"></i>修改GPS</a>';
								  }
							  }else{
								  h='<a class="sq-button-hasicon" href="javascript:addBtn(';
								  h+="'"+rowdata.dtlId+"'";
								  h+=')"><i class="sqBtnIco_4"></i>添加</a>';
							  }
						  }
	                    return h;
	                }
	            }  
	        ],
	        usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '300',
            heightDiff: -2,
            allowUnSelectRow: true,
            alternatingRow: false,
            checkbox:false,
            isSingleCheck:true,
            onLoaded:function(currentData){
                if(currentData && currentData.data.total>0){
                    $("#gridDiv").show();
                }else{
                    $("#gridDiv").hide();
                }
                currentData.toggleLoading.ligerDefer(currentData, 10, [false]);
            }
	    });
		grid = liger.get("grid");
		grid.setHeight(100);
		
	}
	//格式化为人民币格式
	function renderAmt(rowdata, rowindex, value) {
        var h="￥" + FormatMoney(value)
        return h;
    }

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value&&value!=''){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	

	//添加合格证信息
	function addBtn(dtlId){
		var callback = function(){
			 grid.reload();
		}
		var detailFlag = false;
		var timestamp=new Date().getTime();
		Add_navTab( 'tab_prj_prd_veh_info_add'+timestamp,'添加合格证','<%=path%>/project/prjprdvehinfo/toAddPage.do?detailFlag='+detailFlag+'&&dtlId='+dtlId + "&noLinkAction=${noLinkAction}",callback);
	}
	
	//修改合格证信息
	function modifyBtn(id,dtlId,isGpsNode){
		var callback = function(){
			 grid.reload();
		}
		var detailFlag = false;
		Add_navTab( 'tab_prj_prd_veh_info_modify'+id,'修改合格证','<%=path%>/project/prjprdvehinfo/toAddPage.do?detailFlag='+detailFlag+'&&id='+id+'&&dtlId='+dtlId + '&isGpsNode='+isGpsNode + "&noLinkAction=${noLinkAction}",callback);
	}

	function detailBtn(id,dtlId){
		var detailFlag = true;
		Add_navTab( 'tab_prj_prd_veh_info_detail'+id,'合格证详情','<%=path%>/project/prjprdvehinfo/toDetailPage.do?detailFlag='+detailFlag+'&&id='+id+'&&dtlId='+dtlId);
	}
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>

<body class="iframeBody">
	<div class="Wrapper">
       	<div id="pageInTab" class="pageInTab">
	   	<div id="grid" class="sq-grid"></div>
		<div id="gridDiv" class="sqPanel" style="margin-bottom: 0;">
	        <div class="sqPanel_body">
	            <div id="grid" class="sq-grid"></div>
	        </div>
	    </div>
	</div>
</body>
</html>